﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Bing
{
    /// <summary>
    /// Contains parameters for a request to the Translation SourceType.
    /// </summary>
    public class TranslationRequest: IBingRequest
    {
        /// <summary>
        /// Specifies the RFC1766 language code of the term or text block to be translated by a request that specifies the Translation SourceType.
        /// </summary>
        /// <value>The source language.</value>
        /// <remarks>Valid values are:<br />
        /// <table>
        ///  <tbody><tr>
        ///    <th colspan="1">Code</th>
        ///    <th colspan="1">Language</th>
        ///  </tr>
        ///  <tr>
        ///    <td colspan="1">
        ///      <p>
        ///        <strong>Ar</strong>
        ///      </p>
        ///    </td>
        ///    <td colspan="1">
        ///      <p>Arabic</p>
        ///    </td>
        ///  </tr>
        ///  <tr>
        ///    <td colspan="1">
        ///      <p>
        ///        <strong>zh-CHS</strong>
        ///      </p>
        ///    </td>
        ///    <td colspan="1">
        ///      <p>Simplified Chinese</p>
        ///    </td>
        ///  </tr>
        ///  <tr>
        ///    <td colspan="1">
        ///      <p>
        ///        <strong>zh-CHT</strong>
        ///      </p>
        ///    </td>
        ///    <td colspan="1">
        ///      <p>Traditional Chinese</p>
        ///    </td>
        ///  </tr>
        ///  <tr>
        ///    <td colspan="1">
        ///      <p>
        ///        <strong>Nl</strong>
        ///      </p>
        ///    </td>
        ///    <td colspan="1">
        ///      <p>Dutch</p>
        ///    </td>
        ///  </tr>
        ///  <tr>
        ///    <td colspan="1">
        ///      <p>
        ///        <strong>En</strong>
        ///      </p>
        ///    </td>
        ///    <td colspan="1">
        ///      <p>English</p>
        ///    </td>
        ///  </tr>
        ///  <tr>
        ///    <td colspan="1">
        ///      <p>
        ///        <strong>Fr</strong>
        ///      </p>
        ///    </td>
        ///    <td colspan="1">
        ///      <p>French</p>
        ///    </td>
        ///  </tr>
        ///  <tr>
        ///    <td colspan="1">
        ///      <p>
        ///        <strong>De</strong>
        ///      </p>
        ///    </td>
        ///    <td colspan="1">
        ///      <p>German</p>
        ///    </td>
        ///  </tr>
        ///  <tr>
        ///    <td colspan="1">
        ///      <p>
        ///        <strong>It</strong>
        ///      </p>
        ///   </td>
        ///   <td colspan="1">
        ///      <p>Italian</p>
        ///    </td>
        ///  </tr>
        ///  <tr>
        ///    <td colspan="1">
        ///      <p>
        ///        <strong>Ja</strong>
        ///      </p>
        ///    </td>
        ///    <td colspan="1">
        ///      <p>Japanese</p>
        ///    </td>
        ///  </tr>
        ///  <tr>
        ///    <td colspan="1">
        ///      <p>
        ///        <strong>Ko</strong>
        ///      </p>
        ///    </td>
        ///    <td colspan="1">
        ///      <p>Korean</p>
        ///    </td>
        ///  </tr>
        ///  <tr>
        ///    <td colspan="1">
        ///      <p>
        ///        <strong>Pl</strong>
        ///      </p>
        ///    </td>
        ///    <td colspan="1">
        ///      <p>Polish</p>
        ///    </td>
        ///  </tr>
        ///  <tr>
        ///    <td colspan="1">
        ///      <p>
        ///        <strong>Pt</strong>
        ///      </p>
        ///    </td>
        ///    <td colspan="1">
        ///      <p>Portuguese</p>
        ///    </td>
        ///  </tr>
        ///  <tr>
        ///    <td colspan="1">
        ///      <p>
        ///        <strong>Ru</strong>
        ///      </p>
        ///    </td>
        ///    <td colspan="1">
        ///      <p>Russian</p>
        ///    </td>
        ///  </tr>
        ///  <tr>
        ///    <td colspan="1">
        ///      <p>
        ///        <strong>Es</strong>
        ///      </p>
        ///    </td>
        ///    <td colspan="1">
        ///      <p>Spanish</p>
        ///    </td>
        ///  </tr>
        ///</tbody></table>
        /// </remarks>
        public string SourceLanguage { get; set; }

        /// <summary>
        /// Specifies the RFC1766 language code of the language into which a term or text block is to be translated by a request that specifies the Translation SourceType.
        /// </summary>
        /// <value>The target language.</value>
        /// <remarks>Valid values are:<br />
        /// <table>
        ///  <tbody><tr>
        ///    <th colspan="1">Code</th>
        ///    <th colspan="1">Language</th>
        ///  </tr>
        ///  <tr>
        ///    <td colspan="1">
        ///      <p>
        ///        <strong>Ar</strong>
        ///      </p>
        ///    </td>
        ///    <td colspan="1">
        ///      <p>Arabic</p>
        ///    </td>
        ///  </tr>
        ///  <tr>
        ///    <td colspan="1">
        ///      <p>
        ///        <strong>zh-CHS</strong>
        ///      </p>
        ///    </td>
        ///    <td colspan="1">
        ///      <p>Simplified Chinese</p>
        ///    </td>
        ///  </tr>
        ///  <tr>
        ///    <td colspan="1">
        ///      <p>
        ///        <strong>zh-CHT</strong>
        ///      </p>
        ///    </td>
        ///    <td colspan="1">
        ///      <p>Traditional Chinese</p>
        ///    </td>
        ///  </tr>
        ///  <tr>
        ///    <td colspan="1">
        ///      <p>
        ///        <strong>Nl</strong>
        ///      </p>
        ///    </td>
        ///    <td colspan="1">
        ///      <p>Dutch</p>
        ///    </td>
        ///  </tr>
        ///  <tr>
        ///    <td colspan="1">
        ///      <p>
        ///        <strong>En</strong>
        ///      </p>
        ///    </td>
        ///    <td colspan="1">
        ///      <p>English</p>
        ///    </td>
        ///  </tr>
        ///  <tr>
        ///    <td colspan="1">
        ///      <p>
        ///        <strong>Fr</strong>
        ///      </p>
        ///    </td>
        ///    <td colspan="1">
        ///      <p>French</p>
        ///    </td>
        ///  </tr>
        ///  <tr>
        ///    <td colspan="1">
        ///      <p>
        ///        <strong>De</strong>
        ///      </p>
        ///    </td>
        ///    <td colspan="1">
        ///      <p>German</p>
        ///    </td>
        ///  </tr>
        ///  <tr>
        ///    <td colspan="1">
        ///      <p>
        ///        <strong>It</strong>
        ///      </p>
        ///   </td>
        ///   <td colspan="1">
        ///      <p>Italian</p>
        ///    </td>
        ///  </tr>
        ///  <tr>
        ///    <td colspan="1">
        ///      <p>
        ///        <strong>Ja</strong>
        ///      </p>
        ///    </td>
        ///    <td colspan="1">
        ///      <p>Japanese</p>
        ///    </td>
        ///  </tr>
        ///  <tr>
        ///    <td colspan="1">
        ///      <p>
        ///        <strong>Ko</strong>
        ///      </p>
        ///    </td>
        ///    <td colspan="1">
        ///      <p>Korean</p>
        ///    </td>
        ///  </tr>
        ///  <tr>
        ///    <td colspan="1">
        ///      <p>
        ///        <strong>Pl</strong>
        ///      </p>
        ///    </td>
        ///    <td colspan="1">
        ///      <p>Polish</p>
        ///    </td>
        ///  </tr>
        ///  <tr>
        ///    <td colspan="1">
        ///      <p>
        ///        <strong>Pt</strong>
        ///      </p>
        ///    </td>
        ///    <td colspan="1">
        ///      <p>Portuguese</p>
        ///    </td>
        ///  </tr>
        ///  <tr>
        ///    <td colspan="1">
        ///      <p>
        ///        <strong>Ru</strong>
        ///      </p>
        ///    </td>
        ///    <td colspan="1">
        ///      <p>Russian</p>
        ///    </td>
        ///  </tr>
        ///  <tr>
        ///    <td colspan="1">
        ///      <p>
        ///        <strong>Es</strong>
        ///      </p>
        ///    </td>
        ///    <td colspan="1">
        ///      <p>Spanish</p>
        ///    </td>
        ///  </tr>
        ///</tbody></table>
        /// </remarks>
        public string TargetLanguage { get; set; }
        
        /// <summary>
        /// Creates the query string for the API call.
        /// </summary>
        /// <returns>The query string to append to the call.</returns>
        public string ToQueryString()
        {
            string requestString = string.Format("&Translation.SourceLanguage={0}", SourceLanguage);
            requestString += string.Format("&Translation.TargetLanguage={0}", TargetLanguage);
            return requestString;
        }
    }
}
